﻿// JScript 文件
var siteDomain="www.wang1314.com";

//展开收起代码
function $id(id){ return document.getElementById(id) }

function show(dd)
{
	var d=$id(dd);
	if(d.style.display!='none')
		d.style.display='none';
	else
		d.style.display='block';
}
function show2(dd)
{
	var d=$id(dd);
	if(d.style.display!='block')
		d.style.display='block';
	else
		d.style.display='none';

}
function showi(dd, cc)
{
	var d=$id(dd);
	var c=$id(cc);
	var imagePreload = new Image();
    imagePreload.src = '/images/jian_1.gif';
    imagePreload.src = '/images/jian_2.gif';

	if(d.style.display!='none')
	{
		d.style.display='none';
		c.setAttribute( 'src', c.getAttribute('src').replace( '_1', '_2') );
	}
	else
	{
		d.style.display='block';
		c.setAttribute( 'src', c.getAttribute('src').replace( '_2', '_1') );
	}
}
function DSetCookie(name,value,domain,path,secure)
{
    var Days = 0.5; 
    var exp  = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "=" + escape (value) +
        ((exp) ? "; expires=" + exp.toGMTString() : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((path) ? "; path=" + path : "") +
        ((secure) ? "; secure" : "");        
}

function DSetCookieDay(name,value,domain,path,Days,secure)
{
    var exp  = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "=" + escape (value) +
        ((exp) ? "; expires=" + exp.toGMTString() : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((path) ? "; path=" + path : "") +
        ((secure) ? "; secure" : "");        
}

function DGetCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;
}

DSetCookie("isMyPage0412","isOk",siteDomain,"/");

//过滤空格及回车
function trim(str)
{
	for(var i = 0; i<str.length && str.charAt(i)==" "; i++ ) ;
	for(var j =str.length; j>0 && str.charAt(j-1)==" "; j--)  ;
	if(i>j) return "";  
	return str.substring(i,j);
}

function trimR(str)
{
	var rt =/[\r\n]/g;
	var newStr=str.replace(rt,"");
	return newStr;
}

var si=0;
function sethomepage()
{
	var ua = navigator.userAgent;
	var $IE = (navigator.appName == "Microsoft Internet Explorer");
	
	var url="http://www.wang1314.com/site.htm";
	var isSetHome=DGetCookie("isSetHome");
	si=si+1;
	if (isSetHome==null && $IE)
	{
		var thisUrl = document.location.href;
		if (thisUrl.indexOf("/urlinfo/") > -1 || thisUrl.indexOf("/tag/") > -1 || thisUrl.indexOf("/urlsave/") > -1)
		{
		try
		{
			iehomepage.style.behavior='url(#default#homepage)';
			if(!(iehomepage.isHomePage(url)))
			{
				//iehomepage.setHomePage(url);
				//DSetCookieDay("isSetHome","yes",siteDomain,"/",30);
				document.getElementById("iehomepage").style.display="none";
			}
			else
			{
				document.getElementById("iehomepage").style.display="none";				
			}
		}
		catch(e)
		{
			if (si<2)
				document.getElementById("iehomepage").style.display="block";
			else
			{
				DSetCookieDay("isSetHome","yes",siteDomain,"/",30);
				document.getElementById("iehomepage").style.display="none";
			}
		}
		}					
	}
	else
	{
		DSetCookieDay("isSetHome","yes",siteDomain,"/",30);
		document.getElementById("iehomepage").style.display="none";
	}
}

//空操作
function fGoto()
{
	
}
function go()
{
}